package android.slc.box.core.utils;

import io.reactivex.rxjava3.annotations.NonNull;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.stage.Window;
import javafx.stage.WindowEvent;
import org.jetbrains.annotations.NotNull;

public class StageUtils extends WindowUtils{

    /**
     * StageStyle是否没有系统装饰栏
     *
     * @return
     */
    public static boolean stageStyleIsUndecorated(@NonNull Stage currentStage) {
        return currentStage.getStyle() == StageStyle.UNDECORATED || currentStage.getStyle() == StageStyle.TRANSPARENT;
    }

    /**
     * 从ViewUtils设置窗口最小参数
     *
     * @param stage
     */
    public static void setWindowMinSizeFromViewUtils(@NotNull Stage stage) {
        stage.setMinWidth(ViewUtils.getAppWindowMinWidth());
        stage.setMinHeight(ViewUtils.getAppWindowMinHeight());
    }

    /**
     * 从ViewUtils设置窗口最小参数
     *
     * @param stage
     */
    public static void setWindowMaxSizeFromViewUtils(@NotNull Stage stage) {
        stage.setMaxWidth(ViewUtils.getAppWindowMaxWidth());
        stage.setMaxHeight(ViewUtils.getAppWindowMaxHeight());
    }

}
